<ui:fragment xmlns:ui="http://java.sun.com/jsf/facelets"
             xmlns:h="http://java.sun.com/jsf/html"
             xmlns:f="http://java.sun.com/jsf/core"
             xmlns:a4j="http://richfaces.org/a4j"
             xmlns:rich="http://richfaces.org/rich"
             xmlns="http://www.w3.org/1999/xhtml">


    <div id="nomeUsuario">

        <a4j:outputPanel id="messagePanelHead" layout="block">
            <h:messages errorStyle="color: red" rendered="true" infoStyle="color: green" layout="table"/>
        </a4j:outputPanel>
        <h:outputText rendered="#{userManager.authenticated}" value="Bem vindo, #{userManager.user.nome} ::" />
        <h:panelGrid id="carrinho" rendered="#{userManager.authenticated}" >
            <h:form>

                <h:panelGrid  rendered="#{!userManager.admin}" columns="2">

                    <h:commandLink rendered="#{!buyManager.existePedido}"  action="/itemPedido/ListCliente.xhtml" immediate="true">
                        <h:graphicImage  value="/LaCruz_v2/faces/javax.faces.resource/img/empty-shopping-bag-icon_1.png" />
                    </h:commandLink>


                    <h:commandLink rendered="#{buyManager.existePedido}"   action="/itemPedido/ListCliente.xhtml" immediate="true">
                        <h:graphicImage  value="/LaCruz_v2/faces/javax.faces.resource/img/shopping-bag-icon_1.png" />
                    </h:commandLink>

                    <h:outputText rendered="#{!userManager.admin}" value="#{buyManager.quantidadeTotal}"  />
                </h:panelGrid>
            </h:form>
        </h:panelGrid>


    </div>

    <div id="menu">
        <ul>
            <li id="loginlnk" ><a  href="#" onclick="AbreLogin(this);">login</a></li>
            <li>::</li>
            <li><a href="#">sobre</a></li>
            <li>::</li>
            <li>
            <h:form>
                <h:commandLink action="/index.xhtml" value="home" immediate="true" />
            </h:form>
            </li>
        </ul>
    </div>
    <h:form >
        <div id="login"  data-corner="bottom 10px">

            <table class="tableLogin" border="0" cellspacing="0" cellpadding="4">

                <tr>
                    <td width="110" style="text-align:right; font-size: 10px">
                        Usuário:
                    </td>
                    <td width="90" colspan="2">
                <h:inputText id="usuario" value="#{userManager.username}" style="width: 130px" maxlength="50" title="Usuario" />
                </td>
                </tr>
                <tr>
                    <td style="text-align:right;font-size: 10px">Senha:</td>
                    <td ><h:inputSecret id="senha" value="#{userManager.password}" maxlength="8"  style="width: 130px" title="Senha" />
                </td>
                <td rowspan="1">
                <a4j:commandButton value="Login" action="#{userManager.login}" >
                </a4j:commandButton>


                </td>
                </tr>
                <tr>
                    <td colspan="2">
                <h:commandLink style="text-align:right;font-size: 10px;" value="Cadastre-se" action="/usuarioCli/Create.xhtml" /></td>
                <td style="text-align:right;">
                <h:commandLink value="Sair" style="font-size: 10px;" action="#{userManager.logout}"/>
                </td>
                </tr>
            </table>
        </div>
    </h:form>


    <h:form>
        <div class="logo">
            <h:commandLink action="/index.xhtml" immediate="true" >
                <h:graphicImage  value="/LaCruz_v2/faces/javax.faces.resource/img/LaCruz_2.gif" width="600" height="200" alt="LaCruz" />
            </h:commandLink>
        </div>

        <div id="menuAdm" class="menuPai" >
            <h:panelGrid  rendered="#{userManager.authenticated}"  cellspacing="0" cellpadding="0" >

                <rich:toolbar height="40" rendered="#{userManager.admin}" style="border:0px">
                    <rich:dropDownMenu mode="server" >
                        <f:facet name="label"  >
                            <h:panelGroup>
                                <h:outputText value="CADASTRO" />
                            </h:panelGroup>
                        </f:facet>
                        <rich:menuItem  label="PRODUTO"
                                        action="/produto/Create.xhtml" execute="immediate">
                        </rich:menuItem>
                        <rich:menuItem  label="COLEÇÃO"
                                        action="/colecao/Create.xhtml"  />
                        <rich:menuItem  label="USUARIO ADM"
                                        action="/usuarioAdm/Create.xhtml"  />
                    </rich:dropDownMenu>
                    <rich:dropDownMenu mode="server">
                        <f:facet name="label">
                            <h:outputText value="RELATÓRIOS     " />
                        </f:facet>
                        <rich:menuItem  label="CLIENTES/COMPRAS"
                                        action="/pedido/List" >
                        </rich:menuItem>
                        <rich:menuItem  label="FATURAMENTO"
                                        action="/faturamento/View" >
                        </rich:menuItem>
                    </rich:dropDownMenu>

                    <rich:dropDownMenu mode="server">
                        <f:facet name="label">
                            <h:outputText value="GERENCIAL" />
                        </f:facet>
                        <rich:menuItem  label="BAIXA/PAGAMENTO"
                                        action="/itemPedido/List" >
                        </rich:menuItem>
                    </rich:dropDownMenu>
                </rich:toolbar>
            </h:panelGrid>
        </div>
        <div id="menuAdm" class="menuFilho" >
            <h:panelGrid  rendered="#{userManager.authenticated}"  cellspacing="0" cellpadding="0" >
                <rich:toolbar  rendered="#{!userManager.admin}" height="40" style="border: 0;">

                    <rich:menuItem rendered="false" styleClass="mnuCliente"
                                   action="/produto/Create.xhtml" mode="server" execute="immediate">
                        <div style="position: relative; top: 10px;">
                            <h:outputLabel value="Meus Dados"  style="color:#ffffff;"/>
                        </div>
                    </rich:menuItem>
                    <rich:menuItem styleClass="mnuCliente"
                                   action="/itemPedido/ListCliente.xhtml"  execute="immediate" mode="server"    >
                        <div style="position: relative; top: 10px;">
                            <h:outputLabel value="Carrinho"  style="color:#ffffff;vertical-align: middle"/>
                        </div>

                    </rich:menuItem>
                </rich:toolbar>
            </h:panelGrid>
        </div>


    </h:form>



</ui:fragment>






